﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using NUnit.Framework;
using NUnit.Extensions.Forms;

namespace Client
{
    [TestFixture]
    public class Autotest : NUnitFormTest
    {
        static PersonF form2 = null;
        static PersonListF form1 = null;
        static ControlTester ID_b = null;
        static ControlTester PersonListV = null;
        static ControlTester Fname_B = null;
        static ControlTester Lname_B = null;
        static ControlTester Age_B= null;
        static ButtonTester btnCan = null;
        static ButtonTester btnUp = null;
        static ButtonTester btnDel = null;      

        [SetUp]
        public void Initialize()
        {
            form1 = new PersonListF();
            form2 = new PersonF();
            MockPres pt = new MockPres();
            form1.ip = pt;
            form2.ip = pt;            
            form2.Show();
            PersonListV = new ControlTester("PersonListV");
            ID_b = new ControlTester("ID_b");
            Fname_B = new ControlTester("Fname_B");
            Lname_B = new ControlTester("Lname_B");
            Age_B = new ControlTester("Age_B");
            btnCan = new ButtonTester("cancel_btn");
            btnUp = new ButtonTester("update_btn");
            btnDel = new ButtonTester("delete_btn");
            
        }

        [TearDown]
        public void Cleanup()
        {
            form1.Dispose();
            form2.Dispose();
        }
        [Test]
        public void Delete()
        {
           ID_b["Text"] = "1";
           //Fname_B["Text"] = "test";
          // Lname_B["Text"] = "test";
           //Age_B["Text"]="3";  
           btnDel.Click();
            string expected = "delete";
            string actual = form1.teststring;
            Assert.AreEqual(expected, actual);
            
        }     
       

    }
}
